﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace WSIMCommons
{
    public class WSIMUtilities
    {

        public static string SHA2(string input) {
            SHA256Managed crypt = new SHA256Managed();
            byte[] crypto = crypt.ComputeHash(Encoding.ASCII.GetBytes(input), 0, Encoding.ASCII.GetByteCount(input));
            string encoded = "";
            foreach (byte b in crypto) { encoded += (char)b; }
            return encoded;
        }

        private static Random rnd = new Random();

        public static long GetValidID() {
            return DateTime.Now.Ticks + rnd.Next(999);
        }
    }
}
